import pygame
pygame.mixer.pre_init(44100, -16, 2)
pygame.init()

from pygame.locals import *
from math import sin, cos
from numpy import array as arr

import scenes, actions
clock = pygame.time.Clock()
bsod = pygame.image.load('BSOD.png')

def quit_():
    screen = pygame.display.get_surface()
    screen.fill(pygame.Color(0,0,128))
    screen.blit(bsod,(130,100))
    pygame.display.update()
    exit()
    
class Game(object):
    
    def __init__(self, scene):
        window = pygame.display.set_mode((800, 600)) 
        pygame.display.set_caption('Pythanoid 0.1')
        self.screen = pygame.display.get_surface()
        self.scene = scene

    def input(self, events):
        for event in events: 
            if event.type == QUIT or\
                event.type == KEYDOWN and event.key == K_q:
                quit_()
            self.scene.event(event)

    def run(self):
        while 1:
            self.screen.fill(pygame.Color(0,0,0))
            self.input(pygame.event.get())
            self.scene.update()
            self.scene.draw(self.screen)
            pygame.display.flip()
            clock.tick(60)

game = Game(scenes.Intro())
actions.game = game
game.run()
